package kr.hkit.powerjava.chapter12.interfaceex;

public  class TestBox10 implements Comparable {
	private double volume = 0;
	
	public TestBox10 (double v){
		volume =  v;
	}
	
	public int compareTo(Object otherObject){
		TestBox10 other = (TestBox10) otherObject;
		if(this.volume < other.volume) return -1;
		else if(this.volume > other.volume) return 1;
		else return 0;
	}

	public static void main(String[] args) {
		TestBox10 b1 = new TestBox10(100);
		TestBox10 b2= new TestBox10(85.0);
		if(b1.compareTo(b2)>0){
			System.out.println("b1이 b2보다 더 크다");
		}else{
			System.out.println("b1이 b2와 같거나 작다");
		}
				
	}
}
